﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	测压井测压仪
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dolphincontainer">
	    <div id="dolphinnav">
	        <ul>
	            <li><a href="/Stack/Index"><span>堆场管理</span></a></li>
                <li><a href="/Stack/Edit/<%=ViewData["id"] %>"><span>基本信息</span></a></li>
                <li><a href="/Stack/Weather/<%=ViewData["id"] %>"><span>气象信息</span></a></li>
                <li><a href="/Stack/Stack/<%=ViewData["id"] %>"><span>堆场信息</span></a></li>
                <li><a href="/Stack/Pool/<%=ViewData["id"] %>t"><span>调节水池</span></a></li>
                <li><a href="/Stack/Material/<%=ViewData["id"] %>"><span>材料信息</span></a></li>
                <li><a href="/Stack/Settle/<%=ViewData["id"] %>"><span>沉降模型</span></a></li>
                <li><a href="javascript:return(false);" class="current"><span>测压井测压仪</span></a></li>
                <li><a href="/Stack/Drain/<%=ViewData["id"] %>"><span>导渗系统</span></a></li>
	        </ul>
	    </div>
	</div>

    
    <% 
    Piezometer_well_base_info[] wells = (Piezometer_well_base_info[])ViewData["wells"];
    Piezometer_base_info[] topEquaps = (Piezometer_base_info[])ViewData["topEquaps"];
    Piezometer_base_info[] bottomEquaps = (Piezometer_base_info[])ViewData["bottomEquaps"];
    int wellNum = wells.Length;
    int equapNum = topEquaps.Length;

    using (Html.BeginForm("Piezometer", "Stack", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
    %>
        <%= Html.ValidationSummary(true) %>
        <%= Html.Hidden("id", (int)ViewData["id"])%>
        <%
           bool result = (bool)ViewData["success"];
           if(result){ 
        %>
           <div style="text-align:center;margin-top:20px;font-weight:bold;color:blue">测压井测压仪更新成功</div>
        <%
        }
        %>
    <div style="margin-left:10px;margin-top:5px;font-size:14px;font-weight:bold">测压井<input style="margin-left:20px" type="button" value="增加测压井" onclick="addWell();" /></div>      
          
    <table class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:10px">
        <tr class="row1">
            <td id="wells">
                <%
                int i = 0;
                foreach (Piezometer_well_base_info well in wells)
                {
                %>
                <table id="well<%=i + 1 %>" class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:5px;margin-bottom:5px">
                    <tr>
                    <th colspan="4"><%= i + 1 %>号测压井<%if (i > 0) { %><a style='float:right;margin-right:5px' href="javascript:void(0);" onclick="removeWell(<%=i + 1 %>);">X</a><%} %></th>
                    </tr>
                    <tr>
                        <td class="row1" align="right" width="150px">孔顶标高</td>
                        <td class="row1" align="left">
                            <%= Html.TextBox("well_top_El" + (i + 1), well.well_top_El)%>
                        </td>
                        <td class="row1" align="right" width="150px">孔底标高</td>
                        <td class="row1" align="left">
                            <%= Html.TextBox("Well_bottom_El" + (i + 1), well.Well_bottom_El)%>
                        </td>
                    </tr>
                </table>
                <%
                    i++;
                }
                %>
            </td>
        </tr>
    </table>
    <div style="margin-left:10px;margin-top:10px;font-size:14px;font-weight:bold">测压井位置图片：<input style="margin-left:20px" type="file" name="piezometerWellPic" size="80" /><%if(!string.IsNullOrEmpty((string)ViewData["piezometerWellPic"])) {%><a href="<%=Url.Content((string)ViewData["piezometerWellPic"]) %>" target="_blank">查看原图</a><%} %></div>

    <div style="margin-left:10px;margin-top:50px;font-size:14px;font-weight:bold">测压仪<input style="margin-left:20px" type="button" value="增加测压仪" onclick="addEquap();" /></div>      
          
    <table class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:10px">
        <tr class="row1">
            <td id="equaps">
                <%
                i = 0;
                for (;i < topEquaps.Length;)
                {
                %>
                <table id="equap<%=i + 1 %>" class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:5px;margin-bottom:5px">
                    <tr>
                    <th>测压孔编号：<%= i + 1 %><%if (i > 0) { %><a style='float:right;margin-right:5px' href="javascript:void(0);" onclick="removeEquap(<%=i + 1 %>);">X</a><%} %></th>
                    </tr>
                    <tr>
                        <td>
                            <table width="100%" style="background-color:White;margin-top:20px;">
                                <tr height="25px">
                                    <td>&nbsp;</td>
                                    <td>编号</td>
                                    <td>安装深度</td>
                                    <td>感应器底标高</td>
                                    <td>模数系数</td>
                                    <td>初始模数</td>
                                    <td>温度系数</td>
                                    <td>初始温度</td>
                                </tr>
                                <tr height="25px">
                                    <td>高位</td>
                                    <td><%= Html.TextBox("piezometer_name_1_" + (i + 1), topEquaps[i].piezometer_name)%></td>
                                    <td><%= Html.TextBox("Installation_depth_1_" + (i + 1), topEquaps[i].Installation_depth)%></td>
                                    <td><%= Html.TextBox("piezometer_bottom_El_1_" + (i + 1), topEquaps[i].piezometer_bottom_El)%></td>
                                    <td><%= Html.TextBox("Modulus_coefficient_1_" + (i + 1), topEquaps[i].Modulus_coefficient)%></td>
                                    <td><%= Html.TextBox("Initial_Modulus_1_" + (i + 1), topEquaps[i].Initial_Modulus)%></td>
                                    <td><%= Html.TextBox("Temperature_coefficient_1_" + (i + 1), topEquaps[i].Temperature_coefficient)%></td>
                                    <td><%= Html.TextBox("Initial_temperature_1_" + (i + 1), topEquaps[i].Initial_temperature)%></td>
                                </tr>
                                <tr height="25px">
                                    <td>低位</td>
                                    <td><%= Html.TextBox("piezometer_name_2_" + (i + 1), bottomEquaps[i].piezometer_name)%></td>
                                    <td><%= Html.TextBox("Installation_depth_2_" + (i + 1), bottomEquaps[i].Installation_depth)%></td>
                                    <td><%= Html.TextBox("piezometer_bottom_El_2_" + (i + 1), bottomEquaps[i].piezometer_bottom_El)%></td>
                                    <td><%= Html.TextBox("Modulus_coefficient_2_" + (i + 1), bottomEquaps[i].Modulus_coefficient)%></td>
                                    <td><%= Html.TextBox("Initial_Modulus_2_" + (i + 1), bottomEquaps[i].Initial_Modulus)%></td>
                                    <td><%= Html.TextBox("Temperature_coefficient_2_" + (i + 1), bottomEquaps[i].Temperature_coefficient)%></td>
                                    <td><%= Html.TextBox("Initial_temperature_2_" + (i + 1), bottomEquaps[i].Initial_temperature)%></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <%
                    i++;
                }
                %>
            </td>
        </tr>
    </table>
    <div style="margin-left:10px;margin-top:10px;font-size:14px;font-weight:bold">测压仪位置图片：<input style="margin-left:20px" type="file" name="piezometerEquapPic" size="80" /><%if (!string.IsNullOrEmpty((string)ViewData["piezometerEquapPic"])){%><a href="<%=Url.Content((string)ViewData["piezometerEquapPic"]) %>" target="_blank">查看原图</a><%} %></div>
     
 
    <div style="margin-top:25px;text-align:center">
        <%= Html.Hidden("totalWellNum", wellNum)%>
        <%= Html.Hidden("totalEquapNum", equapNum)%>
        <input type="submit" value="提    交" style="font-size:16px;font-weight:bold" />
    </div>
    <% } %>

    <script type="text/javascript"" language="javascript">
        var wellNum = <%= wellNum%>;
        function getInnerHtml(wellNo)
        {
            var htmlStr = "<table id='well" + wellNo + "' class='tableCss' cellspacing='0' cellpadding='0' align='center' border='0' style='margin-top:5px;margin-bottom:5px;'><tr><th colspan='4'>" + wellNo + "号测压井<a style='float:right;margin-right:5px' href='javascript:void(0);' onclick='removeWell(" + wellNo + ");'>X</a></th></tr><tr><td class='row1' align='right' width='150px'>孔顶标高</td><td class='row1' align='left'><input type='textbox' name='well_top_El" + wellNo + "' value='' /></td><td class='row1' align='right' width='150px'>孔底标高</td><td class='row1' align='left'><input type='textbox' name='Well_bottom_El" + wellNo + "' value='' /></td></tr></table>";

	        return htmlStr;
        }        
        
        function addWell() {
            wellNum++;
            $("#wells").append(getInnerHtml(wellNum));
            document.getElementById("totalWellNum").value = wellNum;
        }

        function removeWell(wellNo) {
            wellNum--;
            $("#well" + wellNo).remove();
            document.getElementById("totalWellNum").value = wellNum;
        }

        var equapNum = <%= equapNum%>;
        function getEquapInnerHtml(equapNo)
        {
            var htmlStr = "<table id='equap" + equapNo +"' class='tableCss' cellspacing='0' cellpadding='0' align='center' border='0' style='margin-top:5px;margin-bottom:5px'><tr><th>测压孔编号：" + equapNo +"<a style='float:right;margin-right:5px' href='javascript:void(0);' onclick='removeEquap(" + equapNo +");'>X</a></th></tr><tr><td><table width='100%' style='background-color:White;margin-top:20px;'><tr height='25px'><td>&nbsp;</td><td>编号</td><td>安装深度</td><td>感应器底标高</td><td>模数系数</td><td>初始模数</td><td>温度系数</td><td>初始温度</td></tr><tr height='25px'><td>高位</td><td><input type='text' name='piezometer_name_1_' + " + equapNo +" value='' /></td><td><input type='text' name='Installation_depth_1_' + " + equapNo +" value='' /></td><td><input type='text' name='piezometer_bottom_El_1_' + " + equapNo +" value='' /></td><td><input type='text' name='Modulus_coefficient_1_' + " + equapNo +" value='' /></td><td><input type='text' name='Initial_Modulus_1_' + " + equapNo +" value='' /></td><td><input type='text' name='Temperature_coefficient_1_' + " + equapNo +" value='' /></td><td><input type='text' name='Initial_temperature_1_' + " + equapNo +" value='' /></td></tr><tr height='25px'><td>低位</td><td><input type='text' name='piezometer_name_2_' + " + equapNo +" value='' /></td><td><input type='text' name='Installation_depth_2_' + " + equapNo +" value='' /></td><td><input type='text' name='piezometer_bottom_El_2_' + " + equapNo +" value='' /></td><td><input type='text' name='Modulus_coefficient_2_' + " + equapNo +" value='' /></td><td><input type='text' name='Initial_Modulus_2_' + " + equapNo +" value='' /></td><td><input type='text' name='Temperature_coefficient_2_' + " + equapNo +" value='' /></td><td><input type='text' name='Initial_temperature_2_' + " + equapNo +" value='' /></td></tr></table></td></tr></table>";
	        return htmlStr;
        }        
        
        function addEquap() {
            equapNum++;
            $("#equaps").append(getEquapInnerHtml(equapNum));
            document.getElementById("totalEquapNum").value = equapNum;
        }

        function removeEquap(equapNo) {
            equapNum--;
            $("#equap" + equapNo).remove();
            document.getElementById("totalEquapNum").value = equapNum;
        }
    </script>
</asp:Content>
